import config from 'config';
import httpFetch from 'share/httpFetch';
import errorMessage from 'share/errorMessage';

export default {
    /**
   * 获取区域市场维护列表数据
   * @param {String} url
   */
    getListData (url) {
        return new Promise((resolve, reject) => {
            const res = httpFetch.get(`${config.baseUrl}/api/market/marketCompany/queryAll${url}`).then((res) => {
              resolve(res);
            }).catch((err) => {
              errorMessage(err.response);
              reject(err.response);
            });
        });
  },
    /**
   * 更新一条区域市场信息
   * @param {Object} data
   */
  updateData(data) {
    return new Promise((resolve, reject) => {
      const res = httpFetch.post('/api/market/marketUser/batchCreate', { ...data }).then((res) => {
        resolve(res);
      }).catch((err) => {
        errorMessage(err.response);
        reject(err.response);
      });
    });
  }
}